package com.project.mall.controller;

import com.project.mall.pojo.Comment;
import com.project.mall.pojo.Goods;
import com.project.mall.pojo.Phoneparamters;
import com.project.mall.service.ServiceZ;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/do")
public class ControllerZ {

    @Resource
    private ServiceZ service;

    @RequestMapping("/getGoodsList")
    public String getGoodsList(Model model){
        List<Goods> goods = service.getGoodsList();
        model.addAttribute("goods",goods);
        return "before/xiangqing";
    }

    @RequestMapping("/getGoods")
    public String getGoods(Model model,long paramid){
        List<Phoneparamters> params = service.getGoods(paramid);
        model.addAttribute("params",params);
        return "before/img-list";
    }

    @RequestMapping("/getComments")
    public String getComments(Model model,int gid){
        List<Comment> comments = service.getComments(gid);
        model.addAttribute("comments",comments);
        return "before/show-comments";
    }
}